POV-Ray : Newsgroups : povray.beta-test : macros without commas takes parameter wrongly : macros without commas takes parameter wrongly Server Time
2 Nov 2024 03:15:09 EDT (-0400)
  macros without commas takes parameter wrongly  
From:
Date: 25 Jan 2002 04:48:22
Message: <bp925u4upa1gl9kih2pikg4qusf0lr03kg@4ax.com>
POV 3.5 b 10 on WinNT Sp 6 PII 233 with 128 MB
POV 3.5 b 10 on Win 95 OSR-2 PII 233 with 128 MB

If you run below macro:

//
#include "strings.inc"
#macro A(R T S)
  #debug concat(Vstr(R,0,1)"\n")
  #debug concat(Vstr(T,0,1)"\n")
  #debug concat(Vstr(S,0,1)"\n")
#end
#macro S(T k)A(0,T,k)#end
S(2*y,1)
S(0<.6,.2,1>)
S(-x<.3,.8,2>)
//

then script outputs all parameters unrolled:

<0.0,0.0,0.0>
<0.0,2.0,0.0>
<1.0,1.0,1.0>
<0.0,0.0,0.0>
<0.0,0.0,0.0>
<0.6,0.2,1.0>
<0.0,0.0,0.0>
<-1.0,0.0,0.0>
<0.3,0.8,2.0>

but when you replace line
#macro S(T k)A(0,T,k)#end
with
#macro S(T k)A(0 T k)#end
(only difference are commas replaced with spaces)
then parser ignores third macro parameter 'k' and output is different

<0.0,0.0,0.0>
<1.0,1.0,1.0>
<1.0,1.0,1.0>
<0.0,0.0,0.0>
<0.6,0.2,1.0>
<0.6,0.2,1.0>
<0.0,0.0,0.0>
<0.3,0.8,2.0>
<0.3,0.8,2.0>

Note it is only connected with commas in macro calling. No problem with
commas/spaces in macro definition.

Any confirmation ?

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.